Customizing MaterialsΒΆ

Create a new material

Although Guerilla comes with a comprehensive set of materials, you may require specific adjustments to those shaders, or you may want to design your own shaders from scratch.

Create a new material

In the Create menu, select Create Material. This command creates an empty material named NewMaterial. Double click it in the browser or drag'n drop it from the Node List to any other view to edit its content.

Build your own shading network

Guerilla comes with the basic nodes to build a workable shader. Checkout the library/nodes folder.

Developping shaders in a path tracing environment is not an easy task. Unless you have a good knowledge of path tracing techniques, we strongly encourage you to use the Standard shader node from the library as a basis for your work.

Textures

Adding details to a material is usually done by driving some of their inputs with texture maps to capture small scale variations. For instance, you can use a wood texture instead of the default light brown Albedo input for the VarnishedWood material. Another use of textures is to add geometric complexity by using bump, normal or displacement maps.

Add a texture in a material
  1. Go in the material shading network.
  2. Add the 'SLTexture' shading node. This adds a node that returns the texel value at the surface current st coordinates.
  3. Connect the output of the SLTexture node to the input to drive.

By default the SLTexture returns a white color. This is perfectly normal since you need to choose an image.

Choose an image file
  1. Select the SLTexture node.
  2. Choose an image file by clicking on the Browse button then using file dialog in the SLTexture node Properties view.
  3. Set Gamma, Filter and Mode if needed.

A small preview of the texture is shown in the node Properties view. At first the preview is a plain magenta color, meaning that the texture isn't built or the texture file doesnt exist. The next time you will render your scene, Guerilla Render take care of the build process of the texture. This build step is needed for creating a .tex proxy file with which the renderer work optimally.

Setting the texture directly in the material is possible but you will most likely need to change the texture on a per node or group of nodes basis. Again this will be done using a RenderGraph.

Choose an image file using a RenderGraph
  1. Select the SLTexture node.
  2. Type a keyword in the Name text box in the SLTexture node Properties view. This associates to the texture a string value.
  3. Go in the RenderGraph node network.
  4. Override the keyword input by typing the keyword and select Texture type in the Properties view of a MaterialOverride node, then click on the Add button.
  5. Choose an image file by clicking on the Browse button then using file dialog in the MaterialOverride node Properties view.

As before you will see a small preview of the texture and it will be build during next render.

It's possible to use a command line executable to previously build all the texture to their .tex equivalent.

Dynamic Attributes

You can retrieve a dynamic attribute's value in a shading network.

To retrieve a dynamic attribute

  1. Go in the material shading network.
  2. Add the 'RenderAttr' shading node. This adds a node that returns the dynamic attribute's value of a shaded primitive if available else a default value.
  3. Retrieve the attribute's value by typing its name in the Attr text box in a Properties view.